<!--
 * @Descripttion: 正则表达式量词
 * @Author: YuZhenJing
 * @Date: 2020-07-01 20:58:54
 * @LastEditors: YuZhenJing
 * @LastEditTime: 2020-07-04 14:55:13
-->
<!DOCTYPE html>
<html lang="zh_CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>正则表达式量词</title>
  </head>
  <body>
    <script>
      let title_style = "font-weight: bold;color:red;";
      let test_style = "padding-left:20px;color:yellow;";
      console.log("%c量词介绍：", title_style);
      let text = "anyun666.com.cn";
      console.log("%c * 含义：0到多次：", test_style, text.match(/.*/));
      console.log("%c + 含义：1到多次：", test_style, text.match(/[a-z]+/));
      console.log("%c ? 含义：0到1次：", test_style, text.match(/[a-z]?/));
      console.log("%c {m} 含义：出现m次：", test_style, text.match(/\w{5}/));
      console.log(
        "%c {m,} 含义：出现至少m次",
        test_style,
        text.match(/\w{3,}/)
      );
      console.log("%c {m,n} 含义：m到n次：", test_style, text.match(/\w{5,6}/));
      console.log("%c 量词后面加上?表示最小匹配：", title_style);
      console.log(
        "%c {m,n}? 含义：按最小次数匹配：",
        test_style,
        text.match(/\w{5,6}?/)
      );
    </script>
  </body>
</html>
